package String.entry;

import java.util.Scanner;

/**
 * @Author slsher
 * @Date 2019/3/27 8:45
 */
public class Test {
    public static void main(String[] args) {
        String User="admin";
        String Pass="admin";
        Scanner scanner=new Scanner(System.in);
        System.out.println("请输入用户名");
        String user=scanner.nextLine();
        System.out.println("请输入密码：");
        String password=scanner.nextLine();
        for (int i = 2; i >=0 ; i--) {
            if (i>0){
                if (User.equals(user)&&Pass.equals(password)){
                    System.out.println("登陆成功");
                    System.exit(0);
                }else {
                    System.out.println("登陆失败，你还有"+i+"次机会");
                    System.out.println("请输入用户名");
                     user=scanner.nextLine();
                    System.out.println("请输入密码：");
                     password=scanner.nextLine();
                }
            }else if (i==0){
                System.out.println("登陆失败，账号被锁定，请联系客服");
            }
        }

    }
}
